package com.runmi.webchat.aftersale.web.api.controller;

import java.lang.reflect.InvocationTargetException;

import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.runmi.webchat.aftersale.common.result.Result;
import com.runmi.webchat.aftersale.dbcore.entity.ShopInfo;
import com.runmi.webchat.aftersale.dbcore.mapper.ShopInfoMapper;
import com.runmi.webchat.aftersale.web.api.service.ApiRegionService;
import com.runmi.webchat.aftersale.web.api.vo.ShopInfoResVo;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@RestController
@RequestMapping(value = "/webchatapi/shop")
public class ShopController {

	  @Autowired
	  private ApiRegionService apiRegionService;
	 
	 @Autowired
	 private ShopInfoMapper shopInfoMapper;
	
	  @ApiOperation(value = "根据店铺ID查询店铺信息", notes = "根据店铺ID查询店铺信息",tags={ "微信API", })
	  @RequestMapping(value = "/queryShopInfo")
	  @ResponseBody
	  public ShopInfoResVo queryProvinceRegions(
	          @ApiParam(value = "店铺ID",required = true)@RequestParam(value = "shopId") Integer shopId
	          ) throws Exception, InvocationTargetException{
		  ShopInfoResVo result=new ShopInfoResVo();
	      ShopInfo shopInfo=  shopInfoMapper.selectByPrimaryKey(shopId);
	      BeanUtils.copyProperties(result,shopInfo);
	      result.setMinDate(3);
	      result.setMaxDate(60);
	      return result;
	  }
}
